<!DOCTYPE html>
<html>
 <head></head>
 <body>
 <script src="/assets/jquery/jquery-3.1.1.min.js"></script>
	<script src="/assets/layui-2.9.18/layui.js"></script>
	<link rel="stylesheet" href="/assets/layui-2.9.18/css/layui.css">
	<link rel="stylesheet" href="/assets/layui-2.9.18/css/admin.css">
	<script src="/assets/september/common.js?23"></script>
	<script src="/assets/september/htmlBuilder.js"></script>
	<script src="/assets/september/search.js"></script>
      <link rel="stylesheet" href="/assets/pages/form.css">
   <link rel="stylesheet" href="/assets/pages/couple-input.css">
   
  <div class="layui-form" style="padding: 20px 30px 0 0;"> 
   <form id="form" class="layui-form"> 
    	<input type="hidden" value="${department.id}" name="id"/>
    	<input type="hidden" value="${department.parentId}" name="parent"/>
    	
       <div class="layui-form-item">
           <label class="layui-form-label">部门名称 <em class="required">*</em>  </label>
           <div class="layui-input-inline">
                              <input type="text" name="name"  lay-verify="required"   value="${department.name!}" autocomplete="off" class="layui-input" />
                          </div>
       </div>
                                          
       <div class="layui-form-item">
           <label class="layui-form-label">部门描述  </label>
           <div class="layui-input-inline">
                              <input type="text" name="descb"   value="${department.descb!}" autocomplete="off" class="layui-input" />
                          </div>
       </div>
                                          
       <div class="layui-form-item">
           <label class="layui-form-label">部门编码 <em class="required">*</em>  </label>
           <div class="layui-input-inline">
                              <input type="text" name="code"  lay-verify="required"   value="${department.code!}" autocomplete="off" class="layui-input" />
                          </div>
       </div>
       <#if department.parentId!=-1>                    
       <div class="layui-form-item">
           <label class="layui-form-label">上级部门 <em class="required">*</em>  </label>
           <div class="layui-input-inline">
              <input type="text" disabled lay-verify="required"   value="${department.parent!}" autocomplete="off" class="layui-input" />
          </div>
       </div>
       </#if>
       </form> 
   <div class=""> 
    <input type="button" class="layui-btn layui-btn-normal" style="float:right;margin-bottom:10px;" lay-submit="" lay-filter="submit_button" value="确认" /> 
   </div> 
  </div> 
<script>
layui.config({
	base: '../../../assets/layuiadmin/' //静态资源所在路径
}).extend({
	index: 'lib/index' //主入口模块
}).use(['form','laydate'], function(){
    var form = layui.form ;
    
  	//日期时间选择器
   $('.datetime').each(function(index,obj){
    	initSingleDatetimePickerById($(obj).attr('id'),'date');
    });

   /* 自定义验证规则 */
	//addVerify(form);

	form.on("submit", function (data) {
		prepareFormData(data);
		sajax({
	        type: "POST",
	        url: "/department/doUpdateDepartment",
	        data: data.field,
	        dataType:'json',
           success: function(data){
               layer.msg('保存成功',{shade: [0.1,'#fff'], time:1600});
               closeWindowAndReloadParent();
			   }
	    });
    });
  });
  
</script>  
 </body>
</html>